﻿using System;

public class BubbleSorter
{
    public static void Sort(int[] array)
    {
        if (array == null || array.Length <= 1)
            return;

        int length = array.Length;
        
        for (int i = 0; i < length; i++)
        {
            bool hasSwapped = false;
            
            for (int j = 0; j < length - i - 1; j++)
            {
                if (array[j] > array[j + 1])
                {
                    int temp = array[j];
                    array[j] = array[j + 1];
                    array[j + 1] = temp;
                    hasSwapped = true;
                }
            }
            
            if (!hasSwapped)
                break;
        }
    }
}


class Program
{
    
    static void Main(string[] args)
    {
       
    }
}


/*using System;

public class Student
{
    private string _studentId; 
    private string _name;       
    private int _age;          
    private string _major;      
    
    public string StudentId 
    { 
        get => _studentId; 
        private set 
        {
            if (string.IsNullOrWhiteSpace(value))
                throw new ArgumentException("学号不能为空");
            _studentId = value;
        } 
    }

    public string Name 
    { 
        get => _name; 
        set 
        {
            if (string.IsNullOrWhiteSpace(value))
                throw new ArgumentException("姓名不能为空");
            _name = value;
        } 
    }

    public int Age 
    { 
        get => _age; 
        set 
        {
            if (value < 0 || value > 150)
                throw new ArgumentOutOfRangeException("年龄必须在0到150之间");
            _age = value;
        } 
    }

    public string Major { get; set; }
    
    public Student(string studentId, string name, int age, string major)
    {
        StudentId = studentId;
        Name = name;
        Age = age;
        Major = major;
    }

    public string GetStudentInfo()
    {
        return $"学号: {StudentId}, 姓名: {Name}, 年龄: {Age}, 专业: {Major}";
    }

    public override string ToString()
    {
        return GetStudentInfo();
    }
}
class Program
{
    static void Main(string[] args)
    {
        Student student = new Student("2023001", "张三", 20, "计算机科学");
        Console.WriteLine(student.GetStudentInfo());
    }
}*/
    